<template>
	<view class="content">
        <uni-password :show="true" digits="6" @confirm="confirm">
        	再次确认密码
        </uni-password>
	</view>
</template>

<script>
	
	import md5 from '@/common/md5.js'
	import henglang from '@/common/common.js'
	export default {
		data() {
			return {
				nUserPwd: ''
			}
		},
		onLoad({pwd}) {
			this.nUserPwd = pwd
		},
		methods: {
			confirm(e) {
				let that = this;
				let nUserPwd = md5(that.nUserPwd);
				let nUserPwd_c = md5(e);
				if(nUserPwd != nUserPwd_c){
					henglang.showToast('两次密码不一致')
					return
				}
				henglang.post('member/setPaypwd',{paypwd:nUserPwd,confirm_paypwd:nUserPwd_c},true,function(res){
					if(res.data.code == 0){
						henglang.showToast(res.data.msg,500);
						setTimeout(() => {
							uni.redirectTo({
								url:'/pages/user/settings/set_index'
							})
						}, 500)
					}else{
						henglang.showToast(res.data.msg);
					}
				},function(res){
					henglang.showToast('请求失败');
					return;
				});
				
			}
		}
	}
</script>
<style>
	.content {
		text-align: center;
		height: 400upx;
	}
    .logo{
        height: 200upx;
        width: 200upx;
        margin-top: 200upx;
    }
	.title {
		font-size: 36upx;
		color: #8f8f94;
	}
	
</style>
